<template>
  <div v-if="show" :style="style" id="overlay">
    <div class="overlayt">
      <div class="title">{{ title }}</div>
      <div class="close" @click="closehandle"></div>
    </div>
    <div class="overlayb">
      <div class="overlay-item" v-for="(item, index) in pdata" :key="index">
        <span class="name">{{ index }}</span>
        <span class="value">{{ item }}</span>
      </div>
    </div>
  </div>
</template>

<script>
import map from '../../assets/map'
export default {
  name: "overlay",
  data() {
    return {
      title: "",
      pdata: {},
      style: {},
      show: false,
    };
  },
  created() {},
  mounted() {
    this.pdata = this.getpdata();
  },
  methods: {
    closehandle() {
      this.show = false;
      map.clearPointDx()
    },
    getpdata() {
      let obj = {};
      switch (this.type) {
        case "dzdp":
          this.title = this.pdata.name;
          obj = {
            店名: this.pdata.name || "--",
            街道: this.pdata.street || "--",
            联系人: this.pdata.connectname || "--",
            电话: this.pdata.connectmobile || "--",
            地址: this.pdata.address || "--",
            // "图片": this.pdata.iconimageurl || "",
            "高度(米)": this.pdata.height || "--",
            "宽度(米)": this.pdata.length || "--",
          };
          break;
      }

      return obj;
    },
  },
};
</script>

<style scoped>
#overlay {
  position: absolute;
  color: #fff;
  font-size: 16px;
}
.overlayt {
  min-width: 300px;
  padding: 10px;
  height: 25px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-image: url(~@/assets/image/map/layer-open-top.png);
  display: inline-block;
}
.title {
  margin-left: 20px;
  color: #f0e039;
}
.overlayb {
  padding: 10px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-image: url(~@/assets/image/map/layer-open-bottom.png);
}
.close {
  width: 35px;
  height: 35px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-image: url(~@/assets/image/map/right-top-back.png);
  position: absolute;
  right: 5px;
  top: 5px;
}
.overlay-item {
  padding: 5px 10px;
}
.overlay-item .name {
  margin-right: 20px;
}
</style>